#include "topup.h"
#include "ui_topup.h"

Topup::Topup(User u, QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Topup)
{
    ui->setupUi(this);

    m_user=u;

    ui->labAccount->setText(u.account);
    ui->labBalance->setText(QString::number(u.balance));
}

Topup::~Topup()
{
    delete ui;
}

void Topup::on_btnConfirm_clicked()
{
    m_user.balance+=ui->spinTopUpValue->value();
    emit topUp(ui->combPayWay->currentText(),m_user);
    this->close();
}


void Topup::on_btnCancel_clicked()
{
    this->close();
}

